package com.silp.baitap1;

import java.util.ArrayList;

public class array2 {

	
	private static int[] mang;
	private static ArrayList<Object> list;
	private static Object[] new_mang;
	
	public static Object[] themMang(int index, int value) {
		list = new ArrayList<>();
		for (int i=0;i<mang.length;i++){
			list.add(mang[i]);
		}
				
		list.add(index, value);		
		new_mang = list.toArray();
		return new_mang;
	}
	public static Object[] truMang(int index){
		list = new ArrayList<>();
		for (int i=0;i<mang.length;i++){
			list.add(mang[i]);
		}
				
		list.remove(index);
		new_mang =list.toArray();
		return new_mang;
	}
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		mang = new int[] {96,15,49,44,47,82,28,16,18,27,100,71,94,47,27};
		//Object[] new_mang =themMang(15,112);
		Object[] new_mang =truMang(14);
		for (int i = 0; i < new_mang.length; i++) {
			System.out.println(new_mang[i]);
		}
		/*list = new ArrayList<>();
			for (int i=0;i<mang.length;i++){
				list.add(mang[i]);
			}
					
			list.add(mang.length+1, 111);		
			new_mang = list.toArray();
			
			System.out.println(new_mang.length);
		    for (int i = 0; i < new_mang.length; i++) {
				System.out.println(new_mang[i]);
				
			}*/
			
			
		
	}

	
	}

	
	


